﻿CREATE PROCEDURE [ServiceEngine].[ListEntitiesByGroup]
  @entityGroupID uniqueidentifier 
AS
BEGIN
 SET NOCOUNT ON;

 SELECT 
  N.[EntityID] as ID, 
  N.[EntityName] as [Name], 
  N.EntityDescription as Description
 FROM [ServiceEngine].Names N   
 JOIN [ServiceEngine].Entities_EntityGroups EE ON EE.EntityID = N.EntityID
 JOIN [ServiceEngine].EntityGroups EG ON EE.EntityGroupID = EG.EntityGroupID
 WHERE EG.EntityGroupID = @entityGroupID
END

GO
